package xyz.liuyuhe.StudySpring.ch5.scope;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class ScopeTest {
    public static void main(String[] args) {
        final ApplicationContext context = new ClassPathXmlApplicationContext("classpath*:ch5/scope/singleton-spring.xml");
        System.out.println(System.identityHashCode(context.getBean("helloBeanT")));
        System.out.println(System.identityHashCode(context.getBean("helloBeanT")));
        
        new Thread(){

            @Override
            public void run() {
                System.out.println(System.identityHashCode(context.getBean("helloBeanT")));
            }
            
        }.start();
        
        new Thread(){

            @Override
            public void run() {
                System.out.println(System.identityHashCode(context.getBean("helloBeanT")));
            }
            
        }.start();
    }
}
